/*---------------*/
/* Joseph Porter */
/* Summer of 2012*/
/* Team 1247     */
/*www.ROKSBOT.com*/
/* Camera        */
/*---------------*/
package Team1247Classes.Camera;

import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.camera.AxisCamera;


public class CameraHandler {
    public AxisCamera axisCamera;
    private int panChannel = 0;
    private int tiltChannel = 0;
    private Servo panServo;
    private Servo tiltServo;
    public CameraHandler(){
        this.axisCamera=AxisCamera.getInstance();
    }
    public CameraHandler(int channels[]){
        this.panChannel = channels[0];
        if(this.panChannel!=0){
            panServo = new Servo(panChannel);
        }
        this.tiltChannel = channels[1];
        if(this.tiltChannel!=0){
            tiltServo = new Servo(tiltChannel);
        }
        this.axisCamera=AxisCamera.getInstance();
    }
    public CameraHandler(String ipAdress){
        this.axisCamera=AxisCamera.getInstance(ipAdress);
    }
    public CameraHandler(int channels[],String ipAdress){
        this.panChannel = channels[0];
        if(this.panChannel!=0){
            panServo = new Servo(panChannel);
        }
        this.tiltChannel = channels[1];
        if(this.tiltChannel!=0){
            tiltServo = new Servo(tiltChannel);
        }
        this.axisCamera=AxisCamera.getInstance(ipAdress);
    }
    
    public double Pan(double angle){
        panServo.setAngle(angle);
        
        return panServo.getAngle();
    }
    
    public double Tilt(double angle){
        tiltServo.setAngle(angle);
        
        return tiltServo.getAngle();
    }
    
}
